package com.zsummer.zero.jdk.map;

import java.util.HashMap;
import java.util.Hashtable;
import java.util.LinkedHashMap;
import java.util.TreeMap;
import java.util.concurrent.ConcurrentHashMap;

public class Demo1 {
	
	public static void main(String[] args) {
		//HashMap<String,String> hashMap = new HashMap<String, String>();
		TreeMap<String,String> hashMap = new TreeMap<String, String>(); // 按照key值排序
		//LinkedHashMap<String,String> hashMap = new LinkedHashMap<String, String>(); // 按照插入顺序排序
		for (int i = 100; i > 0; i--) {
			hashMap.put(String.valueOf(i), "a");
		}
		hashMap.put("2", "a");
		for (String key : hashMap.keySet()) {
			System.out.println(key);
		}
		
		
		
//		Hashtable<String, String> hashMap = new Hashtable<String, String>();
//		hashMap.put("a", "a");
//		hashMap.put("b", "b");
//		for (String key : hashMap.keySet()) {
//			hashMap.remove(key);
//		}
//		System.out.println(hashMap.size());
		
//		ConcurrentHashMap<String, String> hashMap = new ConcurrentHashMap<String,String>();
//		hashMap.put("a", "a");
//		hashMap.put("b", "b");
//		for (String key : hashMap.keySet()) {
//			hashMap.remove(key);
//		}
//		System.out.println(hashMap.size());
	}

}
